<template>
	<div>
		<van-cell-group>
			<van-nav-bar title="设置" left-arrow @click-left="back"/>
            <van-row>
              <van-col span="24">
                  <van-button size="large" @click="logout">退出</van-button>
              </van-col>
            </van-row>
		</van-cell-group>
	</div>
</template>
<script>
import {Row,Col,CellGroup,NavBar,Button,Dialog} from 'vant';

export default {
	props: {
        callback:{
            type: Function,
        },
        popup :{
        	type : Boolean,
        	default : false
        }
    },
    components: {
    	[CellGroup.name] : CellGroup,
    	[NavBar.name] : NavBar,
        [Row.name] : Row,
        [Col.name] : Col,
        [Button.name] : Button,
        [Dialog.name] : Dialog,
    },
    data () {
        return {
           
        }
    },
    methods :{
        back(){
        	if (this.popup) {
        		this.callback();
        	}else{
        		window.history.go(-1);
        	}
        },
        logout(){
            Dialog.confirm({
              title: '退出确认',
              message: '你确定要退出吗？'
            }).then(() => {
                this.Axios.Auth.Logout()
                .then(res =>{
                    if(!res) return false;
                    window.location.href="/auth/";
                })
            }).catch(() => {
                
            });
        }
    },
}
</script>
<style>
	.cell-headimg{width: 20px;height: 20px;border-radius: 50%;}
	.lh-20{line-height: 20px;}
</style>